/*
 * @lc app=leetcode.cn id=1716 lang=javascript
 *
 * [1716] 计算力扣银行的钱
 */

// @lc code=start
/**
 * @param {number} n
 * @return {number}
 */
var totalMoney = function (n) {
  const num = n / 7 >> 0;
  const num2 = n % 7;
  return num2 * (num + 1) + num2 * (num2 - 1) / 2 + num * 28 + 7 * num * (num - 1) / 2;
};
// @lc code=end

